(function($) {

	$(window).hashchange(function() {
		if (!location.hash || location.hash == '#') {
			location.hash = '#main';
			return;
		}
		RestAdm.update();
	});
	
	$(window).ready(function() {
		$(window).hashchange();
	});
	
	RestAdm = {};
	
	RestAdm.update = function() {
		var hash = location.hash.substring(1);
		var splited = hash.split('/');
		RestAdm.page = splited.shift();
		RestAdm.args = splited.join('/');
		if(!RestAdm.args.match('/.*')) {
			RestAdm.args = '/' + RestAdm.args;
		}
		$.holy('holy/' + RestAdm.page + '.xml');
		$.holy('holy/nav.xml');
	}
	
})(jQuery);